package test.minseqsubarr;

public class Solution {
    /**
     * 输入: s = 7, nums =
     * [2,3,1,2,4,3]
     * [2,3,1,2]8
     * [3,1,2]6
     * [3,1,2,4]10
     * [1,2,4]7
     * [2,4,3]9
     * [4,3]7
     * 输出: 2
     * 解释: 子数组 [4,3] 是该条件下的长度最小的连续子数组。
     */
    public int minSubArrayLen(int s, int[] nums) {
        //初始化last
        int first=0;
        int last = 0;
        int sum = 0;
        int result = 0;
        int current=0;
        while (first < nums.length) {
            //移动last直到sum>=s
            for (; last < nums.length && sum < s; last++) {
                sum+=nums[last];
                current++;
            }

            //移动first直到sum<s
        }
        return result;
    }
}
